﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using MSNPSharp;

namespace HostHealth
{
    public class Plugin : Plugins.IPlugin
    {
        public List<string> Command
        {
            get { return new List<string>() { "disk", "cpu", "mem" }; }
        }

        public string RootStore { get; set; }
        public string Name
        {
            get { return "Host Health"; }
        }

        public Messenger Messenger { get; set; }

        public string Chat(string Command, string UserID, string Input)
        {

            if (UserID == "rob@mscorlib.com")
            {
            System.Text.StringBuilder sb = new StringBuilder();
                if (Command == "disk")
                {
                    

                    string[] drives = System.Environment.GetLogicalDrives();
                    foreach (string drive in drives)
                    {
                        System.IO.DriveInfo info = new DriveInfo(drive);
                        sb.Append(string.Format("Drive: {0} ({3}); Available Free Space: {1}; Total Size: {2}\n", 
                            info.Name, 
                            info.AvailableFreeSpace, 
                            info.TotalSize, 
                            info.VolumeLabel));
                    }
                }
                return sb.ToString();
            }
            return "Not Authorized";
            
        }

    }
}